package Controller.CourseServlet;

import Dao.CourseDao;
import bean.Course;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet("/course_alter")
public class course_alter extends HttpServlet {
    CourseDao courseDao = new CourseDao();

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        String cno = req.getParameter("cno");
        String cname = req.getParameter("cname");
        String ctime = req.getParameter("ctime");
        String credit = req.getParameter("credit");
        String quota = req.getParameter("quota");
        ArrayList<Course> courseList = courseDao.update(cno, cname, credit, ctime, quota);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
